import numpy as np

class Xdata:
    def __init__(self):
        self.length = 5
        self.x = np.zeros((self.length,))
        self.sub = 0

    def add(self, val:float):
        if self.sub == self.length:
            self.x[:self.length-1] = self.x[1:]
            self.x[self.length-1] = val
        else:
            self.x[self.sub] = val
            self.sub += 1

    def getData(self):
        return self.x.copy()